//
//  inputViewController.m
<<<<<<< HEAD
//  11-26tableView
//
//  Created by blue on 15-11-26.
=======
<<<<<<< HEAD
//  11-30TableView
//
//  Created by blue on 15-11-30.
=======
//  11-26tableView
//
//  Created by blue on 15-11-26.
>>>>>>> 5ff4c636886da2ffea9072a76767c6aa49299c8f
>>>>>>> ab91efe688f96c3bc906a32c05d3d5349d8b8b60
//  Copyright (c) 2015年 hyd. All rights reserved.
//

#import "inputViewController.h"

@interface inputViewController ()<UITextFieldDelegate>
{
    UITextField * tf;
<<<<<<< HEAD
    UITextField * tfName;
=======
<<<<<<< HEAD
    UITextField * tfName;
   
=======
>>>>>>> 5ff4c636886da2ffea9072a76767c6aa49299c8f

>>>>>>> ab91efe688f96c3bc906a32c05d3d5349d8b8b60
}
@end

@implementation inputViewController

<<<<<<< HEAD
- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
=======
<<<<<<< HEAD
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
=======
- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
>>>>>>> 5ff4c636886da2ffea9072a76767c6aa49299c8f
>>>>>>> ab91efe688f96c3bc906a32c05d3d5349d8b8b60
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
<<<<<<< HEAD
    
    tf = [[UITextField alloc]initWithFrame:CGRectMake(16, 0, self.view.frame.size.width - 16, 44)];
    tfName = [[UITextField alloc]initWithFrame:CGRectMake(16, 0, self.view.frame.size.width - 16, 44)];

    tf.text = self.tel;
    tfName.text = self.name;
//    tf.clearButtonMode = UITextFieldViewModeAlways;
//    tf.delegate = self;
//    tf.delegate = self;
//    tfName.delegate = self;
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"保存" style:UIBarButtonItemStylePlain target:self action:@selector(save:)];
    
}

-(void)save:(UIBarButtonItem *)btn1
{
    [self.deledate editssName:tfName.text tel:tf.text];
    [self.navigationController popToViewController:self animated:YES];
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}



 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    UITableViewCell * cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
    [cell.contentView addSubview:indexPath.section == 0 ? tfName: tf];
    return cell;

}

-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    return @[@"姓名",@"号码"][section];
}

=======
<<<<<<< HEAD
	// Do any additional setup after loading the view.
    tf = [[UITextField alloc]initWithFrame:CGRectMake(16, 0, self.view.frame.size.width - 16, 44)];
    
    tfName = [[UITextField alloc]initWithFrame:CGRectMake(16, 0, self.view.frame.size.width - 16, 44)];
    

    tf.text = self.tel;
    tfName.text = self.name;
    //tf.clearButtonMode = UITextFieldViewModeAlways;
    //tf.delegate = self;


}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{

    return 2;

}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    return 1;
    
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    UITableViewCell * cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
    [cell addSubview:indexPath.section == 0 ? tfName : tf];
    
    return cell;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{

    return @[@"姓名:",@"电话:"][section];
=======
    
    tf = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)];
    tf.text = self.tel;
    tf.clearButtonMode = UITextFieldViewModeAlways;
    tf.delegate = self;
    
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"qqqq"];
    
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{

    [textField resignFirstResponder];
    [self.delegate inputFinished:textField.text];
    
    return YES;

}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [tf becomeFirstResponder];
    


}

 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

    return 1;


}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    UITableViewCell * cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
    [cell addSubview:tf];
    return cell;

>>>>>>> 5ff4c636886da2ffea9072a76767c6aa49299c8f

}


<<<<<<< HEAD
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
=======
>>>>>>> ab91efe688f96c3bc906a32c05d3d5349d8b8b60
#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}
@end























































































<<<<<<< HEAD
=======
>>>>>>> 5ff4c636886da2ffea9072a76767c6aa49299c8f
>>>>>>> ab91efe688f96c3bc906a32c05d3d5349d8b8b60
